﻿using dotHTML.HTML;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using dotHTML;
using System.Collections.Generic;

namespace TestdotHTML
{
    
    
    /// <summary>
    ///This is a test class for OutputTest and is intended
    ///to contain all OutputTest Unit Tests
    ///</summary>
    [TestClass()]
    public class OutputTest {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Output Constructor
        ///</summary>
        [TestMethod()]
        public void OutputConstructorTest() {
            Output target = new Output();
            Assert.AreEqual("<output></output>", target.ToString());
        }

        /// <summary>
        ///A test for For
        ///</summary>
        [TestMethod()]
        public void ForTest() {
            Output target = new Output();
            I i = new I();
            B b = new B();
            target.For.Add(i);
            target.For.Add(b);
            Assert.IsTrue(target.For.Count == 2);
            Assert.IsTrue(target.For.Contains(i));
            Assert.IsTrue(target.For.Contains(b));
        }

        /// <summary>
        ///A test for Form
        ///</summary>
        [TestMethod()]
        public void FormTest() {
            Output target = new Output();
            Form expected = new Form();
            Form actual;
            target.Form = expected;
            actual = target.Form;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Name
        ///</summary>
        [TestMethod()]
        public void NameTest() {
            Output target = new Output();
            string expected = string.Empty;
            string actual;
            target.Name = expected;
            actual = target.Name;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToStringTest() {
            Output o = new Output();
            I i = new I();
            i.ID = "iID";
            B b = new B();
            b.ID = "bID";
            o.For.Add(i);
            o.For.Add(b);
            Form f = new Form();
            f.ID = "formid";
            o.Form = f;
            o.Name = "name";
            Assert.AreEqual("<output for=\"iID bID \" " +
                "form=\"formid\" " +
                "name=\"name\"></output>", o.ToString());
        }
    }
}
